package org.kia.manager;

import org.kia.activity.interfaces.BaseActivityInterface;

/**
 * Base class for all of Kia's Managers. <br/>
 * Used to control basic flow and common functionalities
 * 
 * @author Amir Lazarovich & Keren Kalev
 *
 * @param <T>
 */
public abstract class KiaManager<T extends BaseActivityInterface> {

	//////////////////////////////////////////////
	// Members
	//////////////////////////////////////////////
	protected T mActivity;
	
	//////////////////////////////////////////////
	// Overrides & Implementations
	//////////////////////////////////////////////
	
	/**
	 * On activity ready state
	 * 
	 * @param context The interface our activity implements
	 */
	public void onActivityReady(T context) {
		mActivity = context;
		onActivityReady();
	}

	/**
	 * On activity destroy state
	 */
	public void onActivityDestroy() {
		// Since this manager is a singleton, we don't want to keep
		// a reference to a destroyed activity
		mActivity = null;
	}
	
	//////////////////////////////////////////////
	// Abstract
	//////////////////////////////////////////////

	/**
	 * On activity ready state
	 */
	abstract protected void onActivityReady();
}
